<% content_for :sitemap do %>
  <span class="current"><%= t("cpanel.menu.topics")%></span>
<% end %>
<h1><%= t("cpanel.topic_list")%></h1>

<table class="grid">
  <tr class="head">
    <td class="first">ID</td>
    <td style="width:300px">Title</td>
    <td>Node</td>
    <td>User</td>
    <td>Replies</td>
    <td>at</td>
    <td style="width:140px"></td>
  </tr>

<% @topics.each do |topic| %>
  <tr class="<%= 'deleted' if !topic.deleted_at.blank? %>">
    <td class="first"><%= topic.id %></td>
    <td><%= truncate(topic.title,:length => 30) %></td>
    <td><%= topic.node.name if topic.node %></td>
    <td><%= topic.user.login if topic.user %></td>
    <td><%= topic.replies_count %></td>
    <td><%= l topic.created_at,:format => :short %></td>
    <td>
      <% if !topic.suggested_at.blank? %>
        <%= link_to t("common.un_top"), unsuggest_cpanel_topic_path(topic), :confirm => 'Are you sure?', :method => :post %>
      <% else %>
        <%= link_to t("common.place_top"), suggest_cpanel_topic_path(topic), :confirm => 'Are you sure?', :method => :post %>
      <% end %>
      <%= link_to t("common.edit"), edit_cpanel_topic_path(topic) %>
      <% if topic.deleted_at.blank? %>
        <%= link_to t("common.delete"), cpanel_topic_path(topic), :confirm => 'Are you sure?', :method => :delete %>
      <% else %>
        <%= link_to t("common.undelete"), undestroy_cpanel_topic_path(topic), :confirm => 'Are you sure?', :method => :post %>
      <% end %>
    </td>
      
  </tr>
<% end %>
</table>
<%= will_paginate @topics %>
